package com.example.common.exception;

import com.example.common.enumclass.ResultCode;

/**
 * 登入模块
 * 自定义 未授权异常类
 */
public class UnauthorizedException extends RuntimeException {
    private int code;

    // 无参构造函数
    public UnauthorizedException() {
        super("未授权访问");
        this.code = ResultCode.UNAUTHORIZED.getCode();
    }

    // 带参构造函数
    public UnauthorizedException(String message) {
        super(message);
        this.code = ResultCode.UNAUTHORIZED.getCode();
    }

    public int getCode() {
        return code;
    }
}
